﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Coder.Framework;

namespace Coder.ViewModel
{
    /// <summary>
    /// The core of the program: Holds all the variables that are required for the operation of the program.
    /// </summary>
    public class GlobalViewModel : Bindable
    {
        public ChallengeViewModel ChallengeViewModel;
        public EditorViewModel EditorViewModel;
        public Profile Profile;

        public GlobalViewModel()
        {
            ChallengeViewModel = new ChallengeViewModel();
        }

        /// <summary>
        /// Does a global loading of all objects during the startup of the app.
        /// </summary>
        public async Task LoadAll()
        {
            Profile = await Profile.LoadProfile();
            await ChallengeViewModel.RetrieveChallenges(Profile.ChallengesComplete);
        }
    }
}
